package com.wzz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzz.annotation.Cache;
import com.wzz.dto.AddUserDto;
import com.wzz.dto.LoginDto;
import com.wzz.dto.RegisterDto;
import com.wzz.dto.UpdateUserInfoDto;
import com.wzz.entity.ExamRecord;
import com.wzz.entity.ReqExam;
import com.wzz.entity.User;
import com.wzz.exception.BusinessException;
import com.wzz.exception.CommonErrorCode;
import com.wzz.mapper.ReqExamMapper;
import com.wzz.mapper.UserMapper;
import com.wzz.service.ReqExamService;
import com.wzz.service.UserService;
import com.wzz.utils.JwtUtils;
import com.wzz.utils.SaltEncryption;
import com.wzz.vo.PageResponse;
import com.wzz.vo.UserInfoVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import static com.wzz.utils.CommonUtils.setLikeWrapper;
import static com.wzz.vo.UserInfoVo.fromUser;


@Service
@RequiredArgsConstructor
public class ReqExamServiceImpl extends ServiceImpl<ReqExamMapper, ReqExam> implements ReqExamService{

    private final ReqExamMapper reqExamMapper;

    @Override
    public void addReqExam(ReqExam reqExam) {
        reqExamMapper.insert(reqExam);
    }


    @Override
    public List<ReqExam> getReqExamples() {
        QueryWrapper<ReqExam> wrapper = new QueryWrapper<>();
        wrapper.eq("flag","1");
        return reqExamMapper.selectList(wrapper);
    }

    @Override
    public void updateReqExamStatus(Integer id, String flag) {
        ReqExam reqExam=new ReqExam();
        reqExam.setId(id);
        reqExam.setFlag(flag);
        reqExamMapper.updateById(reqExam);

    }
}
